[FW-A-41] Add google test setup#25
Conversation
9b0483e to
d82f28e
Compare
|
Let's start with the explanation what it is. Google Test is a unit test library for C++ programming language, based on xUnit architecture. It can be compiled for a variety of platforms (Windows, MacOS, Linux), allowing unit testing of both C and C++ sources with minimal source modification. It is mostly used to test the part of code if it is compiling efficiently. When you use googletest, you start by writing which are statements that check if a condition is true. Tests use assertions to verify the code behaviour under test. If a test crashes or has an assertion that then it fails otherwise it succeeds. The result of an assertion can be success, nonfatal, or fatal failure. If a fatal failure occurs, it aborts the current one, otherwise the program continues normally. A validation suite contains one or many tests. Tests can be grouped your tests into suites that reflect the structure of the code being tested. When multiple tests in a test suite need to share common objects and subroutines, you can place them in a test fixture class. Besides being developed and used at Google, many other projects implement Google Test as well: On the next post, I will describe functions with more details and display an example. |
d82f28e to
96ac266
Compare
FW-A-41] Add google test setup
|
The whole test (directory) gets built only if unit tests are not disabled globally during configuration. The only thing you must do in your test source file is to include 'gtest/gtest.h' and insert a default main routine that triggers the tests you write before. TEST and TEST_F implicitly register their tests with googletest. So, unlike many other test frameworks, you don't need to list all your tests to run them. After defining your tests, you can run them RUN_ALL_TESTS, which returns 0 if all tests are, or 1 otherwise. RUN_ALL_TESTS runs all binding tests. They can come from different suites or even from different source files. |
3eb6488 to
e657432
Compare
e657432 to
0e2b737
Compare
FW-A-41] Add google test setupFW-A-41] Add google test setup
Resolves: FW-A-41